<?php

class MY_Controller extends Controller {

    var $_data = FALSE;
    var $container = "container";

    function MY_Controller() {
        parent::Controller();
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->helper('lehu_helper');
        $this->load->library('pagination');
        $this->load->library('session');
        $this->load->library('form_validation');
        $this->_data['page_title']='Anima place';
    }

    function display_view($path) {
        $this->before_render();
        $this->_data['view_path'] = $path;
        $this->load->view($this->container, $this->_data);
    }

    function before_render(){
        
    }
}

class FrontEnd_Controller extends MY_Controller {

    function FrontEnd_Controller() {
        parent::MY_Controller();
        $this->load->library('cart');
        $this->load->model('Actualite_m');
        $this->load->model('Accueil_m');
        $this->_data['account_id'] = $this->session->userdata('user_id');
        $header['page'] = "header";
        $footer['page'] = "footer";
        $this->_data['footer'] = $footer;
        $this->_data['header'] = $header;
        $this->_data['is_banner'] = false;
        $this->_data['login_error']=False;
        $this->_data['validate_error']=False;
    }
    function before_render(){
        $this->_data['top_news'] = $this->Actualite_m->get_top_news();
        $this->_data['avatar'] = $this->Accueil_m->get_avatar_user($this->_data['account_id']);
        $this->_data['card_vip'] = $this->Accueil_m->get_card_vip();
    }
}

class Admin_Controller extends MY_Controller {

    function Admin_Controller() {
        parent::MY_Controller();
        $header['page'] = "admin/header";
        $footer['page'] = "admin/footer";
        $sidebar['page'] = "admin/sidebar";
    
        $this->_data['sidebar'] = $sidebar;
        $this->_data['header'] = $header;
        $this->_data['footer'] = $footer;
        $this->container='admin/container';
    }
    function display_view($path) {
        $this->_data['view_path'] = $path;
        $this->load->view($this->container, $this->_data);
    }
}